package com.miaosha;

import org.apache.log4j.Logger;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.Trigger;
import org.quartz.impl.StdSchedulerFactory;

/**
 * 命令行后台启动
 * @author TANGJZ2
 *
 */
public class Main {
	
	public static Logger logger = Logger.getLogger(Main.class);

	public static void main(String[] args) throws Exception{
//		nohup java -jar /miaosha/miaosha.jar "账户" "密码" "09:59:59.150" "0 55 09 * * ?   quartz规则" &
		logger.info("quartz定时调度启动......");
		MiaoShaJob.params = args;
//		MediaService.normalDelayTime = Long.valueOf(args[4]);
		Scheduler scheduler= StdSchedulerFactory.getDefaultScheduler(); 
		JobDetail jobDetail = new JobDetail("anotherJob","SimpleGroup", MiaoShaJob.class);
		Trigger trigger = new CronTrigger("AnotherCronTrigger", null, args[3]);
		scheduler.scheduleJob(jobDetail, trigger);
		scheduler.start();
	}
}
